<?php

namespace App\Service\UserService;

use App\Service\InterfaceService\UserServiceInterface;
use App\Service\BaseService;
use App\Model\PssModel\Business;
use App\Service\Code\Normal;

/**
 * 用户中心服务数据查询管理
 * @author chenshubo
 */
class UserService extends BaseService implements UserServiceInterface
{
    /**
     * 查询用户信息接口
     * @param int $UserID
     */
    public function getUserInfoByUserID( int $UserID )
    {
        $cache_key = "UserID:{$UserID}";
        $redis = redis();
        $userInfo = $redis->get($cache_key);
        if( empty($userInfo) ) {
            $userInfo = Business::instance()->getUserInfoByBid($UserID);
            $redis->set($cache_key,json_encode($userInfo,JSON_UNESCAPED_UNICODE));
        }
        return Normal::returnCode(Normal::SUC,"用户信息获取成功",$userInfo);
    }
}